package com.zkthink.ceres.applet.location.controller;

import com.alibaba.fastjson.JSONObject;
import com.zkthink.base.R;
import com.zkthink.ceres.applet.location.domain.vo.LocationVo;
import com.zkthink.ceres.common.utils.GaoDeMapUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author cmz
 * @Date 2024-04-27 11:47
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/applet/location")
@Api(value = "location", tags = "定位")
public class LocationController {
    @ApiOperation(value = "根据传入的经纬度获取所在的城市信息", notes = "根据传入的经纬度获取所在的城市信息")
    @PostMapping(value = "/getAMapByLngAndLat")
    public R getAMapByLngAndLat(@RequestBody LocationVo locationVo) {
        JSONObject aMapByLngAndLat = GaoDeMapUtil.getAMapByLngAndLat(locationVo.getLongitude(), locationVo.getLatitude());
        return R.success(aMapByLngAndLat);
    }
}
